from fastapi import APIRouter,Query
from typing import Optional
from Business.ModelOne.InfoBasiness import VetionBassiness
from Model.ModelOne import FaskApi_cli

app=APIRouter()

@app.post('/Add',name='增')
def addVertion(
   name:str=Query('最新版',description='版本名称'),
   vertion:str=Query('0.0.1',description='版本号')
):
  return VetionBassiness.add(name,vertion)

@app.post('/Update',name='改')
def updateVertion(
    id:int=Query('1',description='ID'),
    name:str=Query('版本名称',description='版本名称'),
    vertion:str=Query('0.0.0',description='版本号')
):
    data=FaskApi_cli(id=id,name=name,vertion=vertion)
    return VetionBassiness.update(data)

@app.post('/Delete',name='删')
def deleteVertion(
    id:int=Query('1',description='删除的id')
):
    return VetionBassiness.delete(id)

@app.get('/Query',name='查')
def queryVertion():
   return VetionBassiness.getList()


